package com.concurrent.chapter4.concurrent02;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程复用
 * @author shangyidong
 *
 */
public class Main {
	public static void main(String[] args) throws InterruptedException {
		ExecutorService executorService = Executors.newCachedThreadPool();
		for (int i = 0; i < 5; i++) {
			executorService.execute(new MyRunnable("" + i));
		}
		Thread.sleep(2000);
		System.out.println();
		for (int i = 0; i < 5; i++) {
			executorService.execute(new MyRunnable("" + i));
		}
	}
}
